<?php
/**
 * Created by PhpStorm.
 * User: yellow
 * Date: 2019/7/12
 * Time: 18:09
 */

namespace app\common\model;


use think\Model;

class City extends Model
{

    public function region(){
        return $this->hasOne('Region', 'id', 'region_id')->bind(['region_name'=>'name']);
    }

    public function getCreateTimeAttr($value){
        return date('Y-m-d H:i', $value);
    }

    public function setStatusAttr($value){
        if ($value){
            return 1;
        } else{
            return 0;
        }
    }

}